import 'package:get/get.dart';
import 'package:share_fit/app/controllers/base/base_sports_controller.dart';
import 'package:share_fit/app/controllers/home/exercise_records/model/exercise_type.dart';
import 'package:share_fit/app/ute/uteped_const.dart';
import 'package:share_fit/app/ute/uteped_sports.dart';

import 'state.dart';

class WinterSportLogic extends BaseSportsController {
  final WinterSportState state = WinterSportState();

  var winterSportsTypeSelected  = "winterSports";

  onItemSelected(Type type, int index) {
    state.selectedType = type.code;

    changeSelectionsStatus(state.selections, index);

    update([winterSportsTypeSelected]);

    showGoalSettingWin(type.code);
  }

  goBack() {
    Get.back(result: state.selectedType);
  }

  @override
  String getRemotePath() {
    return UTEPedConst.pathSports;
  }

  @override
  void initState() {
    getRealSupportSport(winterSportsTypeSelected).forEach((element) {
      state.typeList.add(ExerciseType(element, ''));
    });

    state.selections = state.typeList.map((e) => false).toList();
    update([winterSportsTypeSelected]);
  }

  @override
  void onRemoteEvent(event, method) {
    // TODO: implement onRemoteEvent
  }
}
